import service.Library;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Library library = new Library();
        Scanner scanner = new Scanner(System.in);
        boolean isRunning = true;
        while (isRunning) {
            System.out.println("\n=== 图书馆管理系统 ===");
            System.out.println("1. 借书");
            System.out.println("2. 还书");
            System.out.println("3. 查看借阅记录");
            System.out.println("4. 退出");
            System.out.print("请选择功能（输入数字）：");
            int choice = scanner.nextInt();
            scanner.nextLine();
            switch (choice) {
                case 1:
                    System.out.print("请输入图书ISBN：");
                    String borrowIsbn = scanner.nextLine();
                    System.out.print("请输入读者证号：");
                    String borrowReaderId = scanner.nextLine();
                    library.borrowBook(borrowIsbn, borrowReaderId);
                    break;
                case 2:
                    System.out.print("请输入要还的图书ISBN：");
                    String returnIsbn = scanner.nextLine();
                    library.returnBook(returnIsbn);
                    break;
                case 3:
                    library.showAllRecords();
                    break;
                case 4:
                    isRunning = false;
                    System.out.println("系统已退出！");
                    break;
                default:
                    System.out.println("输入错误，请重新选择！");
            }
        }
        scanner.close();
    }
}